<template>
    <div>
        <DetailBanner :sightName="sightName" :bannerImg="bannerImg" :gallaryImgs="gallaryImgs"></DetailBanner>
        <DetailHeader></DetailHeader>
        <div class="context">
            <DetailList :categoryList="categoryList"></DetailList>
        </div>
    </div>
</template>

<script>
import axios from 'axios'
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailList from './components/List'
export default {
    name: "detail",
    components: {
        DetailBanner,
        DetailHeader,
        DetailList
    },
    data () {
        return {
            sightName: "",
            bannerImg: "",
            gallaryImgs: [],
            categoryList: [],
        }
    },
    methods: {
        getData () {
            axios.get('/static/mock/detail.json' , {
                params: {
                    id : this.$route.params.id
                }
            })
            .then(
                this.datahandle
            )
        },
        datahandle(res){
            
            let data = res.data
            if(data.ret && data.data) {
                data = data.data
                this.sightName = data.sightName
                this.bannerImg = data.bannerImg
                this.gallaryImgs = data.gallaryImgs
                this.categoryList = data.categoryList
            }
        }
    },
    mounted () {
        this.getData()
    }

}
</script>

<style lang="stylus" scoped>
    .context
        height 50rem
</style>